import React, { Component } from 'react';

//加载模块样式
import { regstate2Style as styles } from '../../../../styles';

import {
    View,
    Text,
    TouchableOpacity,
} from 'react-native';

var Dimensions = require('Dimensions');

var width = Dimensions.get('window').width;          //获取屏幕宽度
import Register_phone from './register_phone';
import Register_email from './register_email';



export default class Registerstate extends Component {

    constructor(props) {
        super(props);
        this.state = {
            reg_state: 0,//手机或账号登录状态  0为账号 1为手机
        }
    }
    render() {
        return (
            <View style={[styles.reg_all, { width: width * 1 }]}>
                <View style={[styles.regstout, { width: width * 0.68 }]}>
                
                    <TouchableOpacity activeOpacity={1}
                        onPress={() => { this.setState({ reg_state: 0 }) }} style={styles.log_tou}> 
                        {this.state.reg_state == 0 ? <Text style={styles.onfocus}>手机注册</Text>
                            : <Text style={styles.unfocus}>手机注册</Text>}
                        {this.state.reg_state == 0 ? <View style={[styles.reg_line, { width: width * 0.14 }]} />
                            : null}
                    </TouchableOpacity>

                    <TouchableOpacity activeOpacity={1}
                        onPress={() => { this.setState({ reg_state: 1 }) }}>
                        {this.state.reg_state == 1 ? <Text style={styles.onfocus}>邮箱注册</Text>
                            : <Text style={styles.unfocus}>邮箱注册</Text>}
                        {this.state.reg_state == 1 ? <View style={[styles.reg_line, { width: width * 0.14 }]} /> : null}
                    </TouchableOpacity>
                </View>

                {this.state.reg_state == 0 ?
                    <Register_phone type={this.props.type} navigation={this.props.navigation}/> :
                    <Register_email type={this.props.type} navigation={this.props.navigation}/>}
            </View>
        )
    }
}